/*************************************************************************
 *
 *  Copyright (C) 2013 Florian Dang <florian.coin@gmail.com>
 *
 *  This file is part of NatusVerse.
 *
 *  NatusVerse is free software: you can redistribute it and/or modify
 *  it under the terms of the GNU General Public License as published by
 *  the Free Software Foundation, either version 3 of the License, or
 *  (at your option) any later version.
 *
 *  NatusVerse is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 *  GNU General Public License for more details.
 *
 *  You should have received a copy of the GNU General Public License
 *  along with NatusVerse.  If not, see <http://www.gnu.org/licenses/>.
 *
 *************************************************************************/

#ifndef INC_RAYTRACER_OBJECTS_PLANE_H_
#define INC_RAYTRACER_OBJECTS_PLANE_H_

/*!
 * \file        plane.h
 * \brief       Plane surface
 * \author      Florian Dang
 * \date        2013
 */
 
#include "raytracer/objects/object.h"
#include "raytracer/objects/point.h"
#include "raytracer/objects/ray.h"

namespace raytracer
{
//! Plane (object subclass)
/*!
  Define a plane geometric surface
*/
class Plane : public Object
{
	public:
		//! plane default constructor
		Plane() {}

		//! plane classic constructor
	 	Plane(Material mat0, Point p0, Vector normal0)
			: Object(mat0), point_(p0), normal_(normal0) {}

		//! plane destructor
		virtual ~Plane() {}

		Plane* clone() const
		{
			return new Plane (* this);
		}

		//! center accessor
		inline Point point() const { return point_; }

		//! radius accessor
		inline Vector normal() const { return normal_; }

	 	bool Intersect(const Ray& ray, float& t) const;

		Vector Normal(const Point& intersection) const { return normal(); }

	 	//! display plane informations on console
	 	void Print() const;

	 	virtual void Move(float dx, float dy, float dz) {}
		
	private:
		Point  point_;  /*!< a point in the plane surface */
		Vector normal_; /*!< a normal vector to the plane surface */
};
}


#endif  // INC_RAYTRACER_OBJECTS_PLANE_H_
